package com.mallsystem.goodsservice;

import com.mallsystem.common.bean.Goods;
import com.mallsystem.common.bean.Score;
import com.mallsystem.common.exception.AllException;
import com.mallsystem.common.service.GoodsService;
import com.mallsystem.common.config.WhiteListConfig;
import com.mallsystem.common.service.ScoreService;
import com.mallsystem.goodsservice.mapper.GoodsMapper;
import com.mallsystem.goodsservice.mapper.ScoreMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class MyTest03 {
    @Autowired
    private GoodsMapper goodsMapper;
    @Autowired
    private GoodsService goodsService;
    @Autowired
    private WhiteListConfig whiteListConfig;
    @Autowired
    private ScoreMapper scoreMapper;
    @Autowired
    private ScoreService scoreService;
    @Test
    public void test1(){
        System.out.println(goodsMapper.selectById(1));
    }
    @Test
    public void test2(){
        Goods condition = new Goods();
        condition.setName("华为");
        goodsMapper.selectByCondition(condition).stream().forEach(System.out::println);
    }
    @Test
    public void test3(){
        goodsService.selectByCondition(new Goods(), 1,5);
    }
    @Test
    public void test4(){
        whiteListConfig.getRules()
                .stream()
                .forEach(System.out::println);
    }
    @Test
    public void test5(){
        int a = 1;
        int b = 1;
        if(a>b){
            System.out.println("111");
        }else if(a==b){
            System.out.println(222);
        }
    }
    @Test
    public void test6(){
        scoreMapper.insert(new Score(null,1,4.5f));
    }
    @Test
    public void test7(){
        System.out.println(scoreMapper.selectByGoodsId(1).size());
    }
    @Test
    public void test8() throws AllException {
        scoreService.insert(new Score(null,1,1f));
    }
}


